
/* -*- mode: C++; tab-width:4; c-basic-offset: 4; indent-tabs-mode:nil -*- */
/************************************************************************
 *
 *  File: Vec2i.hpp
 *
 *  Created: 2009-09-11
 *
 *  Version:
 *
 *  Authors: Christopher Dyken <christopher.dyken@sintef.no>
 *
 *  This file is part of the Sima library.
 *  Copyright (C) 2007 by SINTEF.  All rights reserved.
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  ("GPL") version 2 as published by the Free Software Foundation.
 *  See the file LICENSE.GPL at the root directory of this source
 *  distribution for additional information about the GNU GPL.
 *
 *  For using Sima with software that can not be combined with the
 *  GNU GPL, please contact SINTEF for aquiring a commercial license
 *  and support.
 *
 *  SINTEF, Pb 124 Blindern, N-0314 Oslo, Norway
 *  http://www.sintef.no
 *********************************************************************/

#ifndef _SIUT_SIMD_VEC2I_HPP_
#define _SIUT_SIMD_VEC2I_HPP_

#include <math.h>
#include <cmath>

namespace siut {
  namespace simd {

class Vec2i
{
public:
  Vec2i() {}

  Vec2i(int x, int y)
  {
    vec_[0] = x;
    vec_[1] = y;
  }

  Vec2i(const Vec2i& v)
  {
    vec_[0] = v.vec_[0];
    vec_[1] = v.vec_[1];
  }

  inline int & operator[](int i)
  {
    return vec_[i];
  }

  inline const int&
  operator[](int i) const
  {
    return vec_[i];
  }

  inline int& x()
  {
    return vec_[0];
  }

  inline const int& x() const
  {
    return vec_[0];
  }

  inline int& y()
  {
    return vec_[1];
  }

  inline const int& y() const
  {
    return vec_[1];
  }
 
  inline int& width()
  {
    return vec_[0];
  }

  inline const int& width() const
  {
    return vec_[0];
  }

  inline int& height()
  {
    return vec_[1];
  }

  inline const int& height() const
  {
    return vec_[1];
  }

  inline bool operator==( const Vec2i& v ) const
  {
    return vec_[0] == v.vec_[0] && vec_[1] == v.vec_[1];
  }

  inline bool operator!=( const Vec2i& v ) const
  {
    return vec_[0] != v.vec_[0] || vec_[1] != v.vec_[1];
  }

  inline int area() const
  {
    return vec_[0]*vec_[1];
  }

protected:
  int  vec_[2];
};

typedef Vec2i Dim2;


  } //namespace simd
} //namespace siut
#endif // _SIUT_SIMD_VEC2I_HPP_






